<template>
	<view class="pages-home" v-if="detail">
		
		<image class="top-bg" src="/static/mine/mine_b_bg.png"></image>

		<image mode="scaleToFill" style="width: 100%;" :src="'/static/common/pay_bg1.png'"></image>
		<!-- <image class="image1" mode="aspectFill" :src="'/static/common/pay_bg_'+detail.vipprice+'.png'"></image> -->
<view class="shop-bg flex-column" style="background-color: #FEBCC0;margin:15px;">
				<view style="font-size: 50px;font-weight: bold;text-align: center;color:darkred;margin: 17px;margin-bottom: 10px;">城市生活</view>
							<view style="font-size: 25px;font-weight: bold;text-align: center;">成家立业  百业联盟</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;" v-if="detail.vipprice == 199">
								<text style="color:red;" >198元</text>享396元幸福豆</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;" v-if="detail.vipprice == 2999">
									<text style="color:red;" >2998元</text>享5996元幸福豆</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;" v-if="detail.vipprice == 9999">
											<text style="color:red;" >9998元</text>享19996元幸福豆</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;color:red;"  v-if="detail.vipprice == 199">本   区</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;color:red;"  v-if="detail.vipprice == 2999">本   市</view>
							<view style="font-size: 15px;font-weight: bold;text-align: center;margin-top:10px ;color:red;"  v-if="detail.vipprice == 9999">全   国</view>
							<view style="font-size: 23px;font-weight: bold;text-align: center;color:orange;margin-top:10px ;">会员尊享  消费补贴</view>
				</view>
		<view class="pd-lg" style="padding-top: 0rpx;">
			
			<view class="shop-bg flex-column">
				<view class="f-md-title c-base flex-center">商家消费补贴 积分增值</view>
				<view class="f-title c-base ml-sm flex-warp">
					<view class="f-title c-base ml-sm">
						1.用户凡是加入：
					</view>
					<view class="f-title c-warning" style="width: 150rpx;">伴伴生活</view>
					<view class="f-title c-base">
						商家承诺消费补贴，积分增值，所有商品及服务均可享受消费抵扣幸福豆福利。
					</view>
				</view>
				<view class="f-title c-base ml-sm mt-lg">
					2.致力打造web3.0商业综合服务平台，共享积分消费券分享获得劳务报酬福利。				</view>
				<view class="f-title c-base ml-sm mt-lg">
					3.力求互惠互利，平等交易的原则。发扬互帮
				</view>
<view class="f-title c-base ml-sm mt-lg">
					会员：享受本区内茶水费全免权益，          有效期为1年。
				</view>
				<view class="f-title c-base ml-sm mt-lg">
									vip：享受本市内跨店茶水费全免权益，      有效期为1年。
								</view>
								<view class="f-title c-base ml-sm mt-lg">
												贵宾：享受全国市内跨店茶水费全免权益，有效期为1年。
												</view>
				<view class="f-title c-base ml-sm mt-lg">
					互助的光荣传统。建立共存共荣优良的百业联盟商业体系。
				</view>
				
				<!-- <view class="flex-between mt-lg mb-lg ml-lg mr-lg">
					<view class="btn f-desc c-base radius-10 pl-lg pr-lg">编辑</view>
					<view class="f-desc c-warning">伴伴生活</view>
					<view class="btn f-desc c-base radius-10 pl-lg pr-lg">提交</view>
				</view> -->
				
			</view>
			
			<view class="quan-bg flex-column">
				<view class="f-md-title c-black">消费补贴 积分增值使用说明：</view>
				<view class="f-title c-black ml-lg">1.积分与幸福豆具备消费凭据，</view>
				<view class="f-title c-black ml-lg">2.商家产品可以使用幸福豆消费，</view>
				<view class="f-title c-black ml-lg" style="padding-left: 10px;">积分与实体商家进行当场即时核销使用，</view>
				<view class="f-title c-black ml-lg" style="padding-left: 10px;">同时积分还可以跨店跨行业使用，</view>
				<!-- <view class="f-title c-black ml-lg">3.用户可使用幸福豆参加相亲及商业活动。</view> -->
				
			</view>
			
			<!-- <view class="user-bg flex-column">
				<view class="flex-x-center">
					<view class="flex-column mr-lg">
						<view class="f-title" style="color: #8ec2e5;">{{detail.user_num}}</view>
						<view class="f-little c-black flex-y-center">
							<i class="iconfont clock" style="font-size: 22rpx;" :style="{color:primaryColor}"></i>
							参与人数
						</view>
					</view>
					<view class="flex-column ml-lg">
						<view class="f-title" style="color: #eaad7c;">{{detail.traffic_volume}}</view>
						<view class="f-little c-black flex-y-center">
							<i class="iconfont clock" style="font-size: 22rpx;"></i>
							访问量
						</view>
					</view>
				</view>
				<view style="width: 100%;" class="flex-warp">
					<view class="fill-base pb-md pl-md pr-md pd-lg flex-center"
						v-for="(item, index) in detail.user_list" :key="index" style="width: 14%;">
						<view @tap.stop="goUserDetail(item.id)" class="flex-column">
							<image mode="aspectFill" class="cover" :src="item.avatar"></image>
							<view style="margin-top: 5rpx; max-height: 40rpx; max-width: 80rpx; white-space: normal; overflow: hidden; -webkit-line-clamp: 1;">{{item.user_nicename}}</view>
						</view>
					</view>
				</view>
			</view> -->
			
			<view class="shop-list-bg flex-column">
				
				<view style="width: 100%;" class="flex-warp">
					<view class="fill-base pb-md pl-md pr-md pd-lg flex-center"
						v-for="(item, index) in detail.goods_list" :key="index" style="width: 33%;">
						<view @tap.stop="goGoodsDetail(item.id)" class="flex-column">
							<image mode="aspectFill" class="cover" :src="item.thumbs"></image>
							<view class="f-title flex-center" style="margin-top: 5rpx;">豆:{{item.original_price - item.present_price}}</view>
						</view>
					</view>
				</view>
				
			</view>
			
			<view class="msg-bg fill-base flex-column">
				<view class="flex-center mb-lg" style="width: 100%;">
					<view class="btn f-md-title c-base flex-center">使用须知</view>
				</view>
				
				<view class="f-title c-black ml-sm mb-lg">
					使用须知：<br/>
					1.消费结束后，商家福利仍可正常使用；<br/>
					<!-- 2.点击有上角“..”收藏，可以做为带货商品，享受分享福利；<br/> -->
					2.商家福利，请查看商家复现详细说明；<br/>
					3.本活动为特价消费补贴福利，一经购买不予退款；<br/>
					4.该幸福豆适用于参与本活动品牌指定门店；<br/>
					5.兑换时，请到联盟商店铺点使用进入相应商家扫码核销；<br/>
					6.长按下图二维码，获取活动相关通知；<br/>
					7.平台有权利更换等价商家优惠；<br/>
					8.在法律允许范围内，平台拥有解释权；<br/>
				</view>
				
				<view class="flex-center" style="width: 100%;">
					<image mode="aspectFill" class="cover mr-md" src="/static/common/kefu_code.png"></image>
					<view class="c-base flex-center flex-column ml-lg">
						<view class="f-icontext c-black flex-center">客服电话：136 8640 0082</view>
						<view class="f-title c-black flex-center mt-md">长按识别二维码</view>
						<view class="f-title c-black flex-center">免单会相关咨询</view>
					</view>
				</view>
				
			</view>
			
			
		</view>

		<view class="space-max-footer"></view>
		<view class="space-max-footer"></view>
		<view class="paydoudou">
			<view class="betweentext">
			<text>幸福豆：99.5</text><text style="color:lightgrey;">(总：{{detail.hbean}})</text>
		<radio :value="1" :checked="isusedou" @click="nouselegumes"/>
		</view>
		</view>
		<fix-bottom-button @confirm="confirm"
			:text="[{type:'confirm',text:'立即支付￥99.5'}]" bgColor="#fff">
		</fix-bottom-button>

	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import siteInfo from '@/siteinfo.js';
	import parser from "@/components/jyf-Parser/index"
	import $api from '@/api/index.js';
	export default {
		components: {
			parser
		},
		data() {
			return {
				options: {},
				activeIndex: 0,
				rule: {
					0: 'introduce',
					1: 'explain',
					2: 'notice'
				},
				isusedou:true,
				detail: {},
				coins: [
					{
						title: "免费",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥9.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥29.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥99.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥199",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥9.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥29.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥99.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥199",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥9.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥29.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥99.9",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					},
					{
						title: "￥199",
						url: "https://text.10-yuan.com/attachment/image/666/23/06/6837c876753f49c695154234caa31352.jpg"
					}
				],
				coinChangeindex: 1,
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			userInfo: state => state.user.userInfo,
		}),
		onLoad(options) {
			this.$util.showLoading()
			this.options = options
			this.initIndex()
		},
		nouselegumes()
		{
			this.isusedou = !this.isusedou
			if(this.isusedou ==false)
			{
				uni.showToast({
					icon:'error',
					title:'需要支付对应金额的幸福豆才能购买会员'
				})
			}
		},
		onPullDownRefresh() {
			this.initRefresh();
			uni.stopPullDownRefresh()
		},
		methods: {
			...mapActions(['getConfigInfo', 'getUserInfo']),
			...mapMutations(['getUserIndex']),
			async initIndex(refresh = false) {
				if (!this.configInfo.id || refresh) {
					await this.getConfigInfo()
				}
				await this.getDetail()
				this.$util.setNavigationBarColor({
					bg: this.primaryColor
				})
			},
			initRefresh() {
				this.initIndex(true)
			},
			async getDetail() {
				let data = await this.$api.user.getBalance();
				this.detail = data;
				this.coins = this.detail.rules
				this.$util.hideAll()
			},
			handerTabChange(index) {
				this.activeIndex = index;
			},
			sign(){
				
			},
			async confirm(){
				if(this.activeIndex == 0){
					let data = this.coins[this.coinChangeindex]
					if (this.lockTap) return;
					this.lockTap = true;
					this.$util.showLoading()
					try {
						let {
							pay_list
						} = await this.$api.user.bindUserPhone({
							changeid: 18
						})
						this.$util.hideAll()
						if (pay_list) {
							try {
								await this.$util.pay(pay_list)
								this.lockTap = false;
								await this.getMineInfo()
								this.$util.back()
							} catch (e) {
								this.lockTap = false;
								return;
							}
						}
					} catch (e) {
						setTimeout(() => {
							this.lockTap = false
							this.$util.hideAll()
						}, 2000)
					}
				} else {
					this.setCash()
				}
			},
			goUserDetail(id) {
				let url = `/user/pages/user-detail?id=${id}`
				this.$util.goUrl({
					url
				})
			},
			// 详情
			goGoodsDetail(id) {
				let url = `/user/pages/detail?id=${id}`
				this.$util.goUrl({
					url
				})
			},
		}
	}
</script>

<style lang="scss">
	.pages-home {
		.top-bg{
		    // position: absolute;
		    // width: 100%;
		    // height: 5000rpx;
		    // z-index: -1;
			position: fixed;
			width: 100%;
			height: 100%;
			top: 0rpx;
			left: 0;
			z-index: -1;
		}
		
		.image1 {
			position: absolute;
			margin: 20rpx 10rpx;
			border-radius: 42rpx;
			
			width: 98%;
			// text-align: center;
		}
		
		.shop-bg {
			background-color: #a27b6c;
			border-radius: 42rpx;
			margin: 10rpx 10rpx;
			padding: 15rpx 15rpx;
			margin-bottom: 40rpx;
			.btn {
				background-color: #5e2d37;
			}
		}
		
		.quan-bg {
			background-color: #dededc;
			border-radius: 42rpx;
			margin: 10rpx 10rpx;
			padding: 15rpx 15rpx;
			margin-bottom: 40rpx;
		}
		
		.user-bg {
			background-color: #fff;
			border-radius: 42rpx;
			margin: 10rpx 10rpx;
			padding: 15rpx 15rpx;
			margin-bottom: 40rpx;
			.cover {
				width: 60rpx;
				height: 60rpx;
				border-radius: 30rpx;
			}
		}
		
		.shop-list-bg {
			background-color: #fff;
			border-radius: 42rpx;
			margin: 10rpx 10rpx;
			padding: 15rpx 15rpx;
			margin-bottom: 40rpx;
			.cover {
				width: 160rpx;
				height: 100rpx;
				border-radius: 20rpx;
			}
		}
		
		.msg-bg {
			background-color: #fff;
			border-radius: 42rpx;
			margin: 10rpx 10rpx;
			padding: 15rpx 15rpx;
			margin-bottom: 40rpx;
			.btn {
				width: 60%;
				height: 80rpx;
				background-color: #d04860;
				border-radius: 20rpx;
			}
			.cover {
				width: 160rpx;
				height:160rpx;
				border-radius: 0rpx;
			}
		}
		
		.item-btn {
			height: 54rpx;
			padding-left: 15rpx;
			padding-right: 15rpx;
		}
		.total-box {
			width: 100%;
			height: 84rpx;
			background-color: #fff;
			.box-btn {
				margin: 0;
				padding: 0;
				margin-right: 2rpx;
				height: 62rpx;
				display: flex;
				align-items: center;
				background-color: #e4e4e4;
				border-radius: 42rpx;
				line-height: 1.5;
				border-color: #000;
				border-width: 2rpx;
				text-align: left;
				color: #333;
			}
			.box-btn2 {
				margin: 0;
				padding: 0;
				margin-right: 2rpx;
				height: 62rpx;
				display: flex;
				align-items: center;
				background-color: #bccfde;
				border-radius: 42rpx;
				line-height: 1.5;
				border-color: #000;
				border-width: 2rpx;
				text-align: left;
				color: #333;
			}
		}
	
		.user-item {
			background-color: #fff;
			float: left;
			box-sizing: border-box;
			width: 44%;
			text-align: center;
			height: 100rpx;
			// padding: 10px 6px;
			
			.cover {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50rpx;
			}
		}
		
		.user-list {
			background-color: #fff;
			float: left;
			box-sizing: border-box;
			width: 100%;
			text-align: center;
			height: 100rpx;
			// padding: 10px 6px;
			
			.cover {
				width: 50rpx;
				height: 50rpx;
				border-radius: 50rpx;
			}
		}
		
		.msg {
			background-color: #fff;
			float: left;
			box-sizing: border-box;
			width: 100%;
			height: 100rpx;
			padding-bottom: 400rpx;
			// padding: 10px 6px;
		}
	.paydoudou{
			  position: fixed; 
			  bottom: 55px; 
			  width: 100%; 
			  height:57px;
			  padding:10px;
			
			  background-color: #fff;
	}
	.betweentext{
			  display: flex;
			  justify-content: space-between;
			  padding: 10px;
	}
	
	}
</style>
